#include "include.h"
#include "func.h"
#include "func_music.h"
#include "func_exspiflash_music.h"

#if (EX_SPIFLASH_SUPPORT)
extern void func_lower_power_check(void);
extern void test_color(void);

AT(.text.func.music.msg)
void func_exspifalsh_music_message(u16 msg)
{

   if(msg!=0&&msg!=0x7ff&&(msg&0x800))
	{
		printf("msg:0x%x\n",msg);
	}
    switch (msg) {
        case KU_SONG1:
			func_switch_song();
            break;
        case KU_MIC:
			#if 0
			test_color();
			break;
			#endif
			func_switch_mic_onoff(1);
			break;
		case KU_BT:
			music_control(MUSIC_MSG_STOP);
			func_cb.sta = FUNC_BT;
			break;
		case KL_BT:
			music_control(MUSIC_MSG_STOP);
			sys_cb.bt_mode=1;			
			func_cb.sta = FUNC_BT;
			break;
        case KL_POWER:
		case KU_POWER:
			music_control(MUSIC_MSG_STOP);
			sys_cb.pwrdwn_tone_en = 1;
			func_cb.sta =FUNC_PWROFF;
			break;
		case MSG_SYS_1S:
			func_lower_power_check();
			func_check_timeout();
			
			
			break;
		case EVT_MIC_INSERT:
			printf("mic_unmute\n");
			//func_switch_mic_onoff(1);
			break;
		case EVT_MIC_REMOVE:
			printf("mic_mute\n");
			//func_switch_mic_onoff(0);
			break;
		case EVT_MODE_3P_TO_DEMO:
		case EVT_MODE_3P_TO_HOME:
			printf("3p switch!!\n");
			music_control(MUSIC_MSG_STOP);
			sys_cb.pwrdwn_tone_en = 0;
			func_cb.sta =FUNC_PWROFF;
			break;
        default:
			//auto_stop_play_timer();
           // non_volatile_memory();
            func_message(msg);
            break;
    }
}
#endif //(EX_SPIFLASH_SUPPORT & EXSPI_MUSIC)

